<html>
<head>

	<script type="text/javascript" src="soapclient.js"></script>
	<script type="text/javascript">
	
//	var url = "http://www.guru4.net/articoli/javascript-soap-client/demo/webservicedemo.asmx";
	var url = "http://www.ihomechina.com/service/ihomesvc.php";
	
	// DEMO 1
	function HelloWorld()
	{
		var pl = new SOAPClientParameters();
		pl.add("x", 30);
		pl.add("y", 120);
		SOAPClient.invoke(url, "adddata", pl, true, HelloWorld_callBack);
	}

	function hel()
	{
                var pl = new SOAPClientParameters();
		pl.add("x", 33);
		pl.add("y", 120);
                SOAPClient.invoke(url, "adddata", pl, true, hel1_callBack);
	}
	
	function getbyid()
	{
		var pl = new SOAPClientParameters();
		pl.add("UserName","seraphjiang");
		SOAPClient.invoke(url,"GetMemberByName",pl,false,getbyid_callBack);

	
	}


	function getbyid_callBack(r)
	{
		alert(r);
	}
	function hel1_callBack(r)
	{
		alert(r);
	}
	function getUser()
	{
		var pl=new SOAPClientParameters();
		pl.add("x",10);
		SOAPClient.invoke(url,"GetMemberByName",pl.true,getuser_callBack);
	}
	function HelloWorld_callBack(r)
	{
		alert(r);
	}
	function getuser_callBack(r)
	{
		alert(r.ID);
	}
	function HelloWorld1(r)
	{
		alert(r.ID);
	}


        function setmember()
        {
                var pl = new SOAPClientParameters();
		var usr = new Object();
		usr.ID =  document.getElementById('postno').value;
		usr.Status = -1;
	
                pl.add("User", usr);
                SOAPClient.invoke(url,"SetMember",pl,false,setmember_callBack);


        }	
	function setmember1(ss)
	{
                var pl = new SOAPClientParameters();
                var usr = new Object();
                //usr.ID =  document.getElementById('postno').value;
		usr.ID = ss;
                usr.Status = -1;

                pl.add("User", usr);
                SOAPClient.invoke(url,"SetMember",pl,true,setmember_callBack);

	}
	function setmember_callBack(r)
	{

                SOAPClient.invoke(url,"SetMember",pl,false,setmember_callBack);
	
		//alert(r.ID);
		//document.write(r["ID"]);
	}

	function setmembers()
	{
	for(var i0=0;i0<2;i0++)
	{
		for(var i1=0;i1<4;i1++)
		{
			for(var i22=0; i22 < 9; i22++)
			{
				for(var i3=0;i3<10;i3++)
				{
					var myno;
					myno = ''+ i0;
					myno = myno + '' + i1;
					myno = myno + '' + i22;
					myno = myno + '' + i3;
					setmember1(myno);
				}
			}
		}
	}
	}

	function setmembers_callBack(r)
	{
		document.getElementById('outp').value = r.ID;
	}

	function Hello1()
	{
		var ob1;
		obj = new Object();
		obj.ID = "test";
		alert (obj.ID);
	}
	
	</script>
</head>

<body>

        <input type="button" value="test object" onclick="Hello1();" />


        <input type="button" value="Say &quot;Hello world&quot;" onclick="HelloWorld();" />
        <input type="button" value="oh yeah" onclick="hel();" />
        <input type="button" value="oh 1111" onclick="getbyid();" />

        <input type="button" value="add member" onclick="setmember();" />
        <input type="button" value="add members..." onclick="setmembers();" />

	
        <input type="text" id="postno" name="postno" value="0004" />
        <input type="text" id="outp" name ="outp" value="oh 1111" />


</body>
